/* ====================================
   运费计算页面专用样式 (freight-calculation.css)
   实现现代化的运费计算界面设计
   ==================================== */

/* 页面标题样式 */
.freight-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
    display: inline-block;
}

/* 运费计算表单容器 */
.freight-calculation-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* 计算表单卡片 */
.freight-form-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8ecf4;
    position: relative;
}

.freight-form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), #66b1ff);
    border-radius: 12px 12px 0 0;
}

/* 表单网格布局 */
.freight-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

/* 针对大屏幕优化，确保一行四个 */
@media (min-width: 1024px) {
    .freight-form-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }
}

/* 中等屏幕显示三个 */
@media (min-width: 768px) and (max-width: 1023px) {
    .freight-form-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.8rem;
    }
}

/* 表单组优化 */
.freight-form-group {
    margin-bottom: 0;
}

.freight-form-label {
    display: inline-block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 12px;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.freight-form-label.required::after {
    content: '*';
    color: var(--color-danger);
    margin-left: 4px;
}

.freight-form-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.7rem;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text-primary);
    background-color: #ffffff;
    border: 1px solid #e8ecf4;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
    min-height: 36px;
}

.freight-form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.1);
}

.freight-form-input::placeholder {
    color: #a0a6b8;
    font-size: 12px;
}

/* 策略选择器样式 */
.freight-strategy-selector {
    position: relative;
}

.freight-strategy-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.freight-strategy-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.freight-strategy-option:hover {
    background-color: #f8faff;
    color: var(--color-primary);
}

.freight-strategy-option.selected {
    background-color: var(--color-primary);
    color: white;
}

/* 区域选择器样式 */
.freight-area-selector-container {
    position: relative;
}

.freight-area-selector-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.7rem;
    background-color: #ffffff;
    border: 1px solid #e8ecf4;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 36px;
    font-size: 13px;
}

.freight-area-selector-input:hover {
    border-color: var(--color-primary);
}

.freight-area-selector-arrow {
    font-size: 12px;
    color: #a0a6b8;
    transition: transform 0.3s ease;
}

.freight-area-selector-arrow.expanded {
    transform: rotate(180deg);
}

.freight-area-selector-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--color-primary);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    margin-top: 4px;
    overflow: hidden;
}

/* 按钮组样式 */
.freight-form-actions {
    display: flex;
    gap: 0.8rem;
    justify-content: flex-start;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e8ecf4;
}

.freight-btn-calculate {
    background: linear-gradient(135deg, var(--color-primary) 0%, #66b1ff 100%);
    color: white;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(64, 158, 255, 0.3);
    letter-spacing: 0.3px;
}

.freight-btn-calculate:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 158, 255, 0.4);
}

.freight-btn-calculate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.freight-btn-reset {
    background: transparent;
    color: var(--color-text-secondary);
    padding: 0.6rem 1.2rem;
    border: 1px solid #e8ecf4;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.freight-btn-reset:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background-color: #f8faff;
}

/* 运费计算结果容器 */
.freight-result-container {
    margin-top: 2rem;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    animation: slideInUp 0.6s ease-out;
    background: linear-gradient(135deg, #6b73ff 0%, #9b59b6 50%, #8e44ad 100%);
    position: relative;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 结果标题栏 */
.freight-result-header {
    background: transparent;
    color: white;
    padding: 1rem 2rem;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.freight-result-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.freight-result-title::before {
    content: '📋';
    font-size: 1.2rem;
}

/* 运费总额显示 */
.freight-result-amount {
    background: transparent;
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
}

.freight-amount-label {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.freight-amount-value {
    font-size: 4rem;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: -2px;
}

/* 计算明细 */
.freight-result-details {
    background: white;
    padding: 0;
    margin: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.freight-details-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    padding: 1.5rem 1.5rem 0 1.5rem;
    position: relative;
}

.freight-details-title::before {
    content: '📊';
    margin-right: 0.5rem;
}

.freight-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s;
}

.freight-detail-item:last-of-type {
    border-bottom: none;
}

.freight-detail-item:hover {
    background-color: #f8faff;
}

.freight-detail-label {
    font-weight: 500;
    color: var(--color-text-regular);
    font-size: 14px;
}

.freight-detail-value {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 14px;
}

.freight-detail-value.highlight {
    color: var(--color-primary);
    font-size: 16px;
    font-weight: 700;
}

/* 计算公式展示 */
.freight-calculation-formula {
    background: #f8faff;
    border: 1px solid #e8ecf4;
    border-radius: 8px;
    margin: 1.5rem;
    position: relative;
    overflow: hidden;
}

.freight-formula-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    padding: 1rem 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border-bottom: 1px solid #e8ecf4;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.freight-formula-title:hover {
    background-color: #f8faff;
}

.formula-toggle-icon {
    font-size: 12px;
    color: #a0a6b8;
    transition: transform 0.3s ease;
}

.formula-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.freight-formula-content {
    font-family: var(--font-family-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #2d3748;
    background: white;
    padding: 1.5rem;
    border-left: 4px solid var(--color-primary);
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.freight-formula-content.detailed-formula {
    background: #f8f9fa;
    font-size: 12px;
    border-left-color: #6b73ff;
}

/* 响应式设计 */
@media (max-width: 767px) {
    .freight-calculation-container {
        padding: 0.5rem;
    }
    
    .freight-form-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .freight-form-card {
        padding: 1.2rem;
    }
    
    .freight-form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .freight-btn-calculate,
    .freight-btn-reset {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .freight-amount-value {
        font-size: 2.5rem;
    }
    
    .freight-result-details {
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .freight-form-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .freight-result-amount {
        padding: 2rem 1rem;
    }
    
    .freight-amount-value {
        font-size: 2rem;
    }
    
    .freight-formula-content {
        font-size: var(--font-size-formula-mobile);
        line-height: var(--line-height-formula-mobile);
        padding: 1rem;
    }
    
    .freight-form-input,
    .freight-area-selector-input {
        min-height: 40px;
        padding: 0.6rem 0.8rem;
    }
}

/* 加载状态 */
.freight-calculating {
    position: relative;
    overflow: hidden;
}

.freight-calculating::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: calculating 1.5s infinite;
}

@keyframes calculating {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 错误和成功消息样式 */
.freight-message {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.freight-message.error {
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    color: var(--color-danger);
    border: 1px solid #f5c6cb;
}

.freight-message.success {
    background: linear-gradient(135deg, #efe 0%, #dfd 100%);
    color: var(--color-success);
    border: 1px solid #c3e6cb;
}

.freight-message.error::before {
    content: '❌';
}

.freight-message.success::before {
    content: '✅';
}